Class: RunApi::Suno::Client

Inherits:
Core::Client
  • Object
show all
Defined in:
lib/runapi/suno/client.rb

Overview

Suno music platform client covering song generation, extension, covers, stems, MIDI, lyrics, mashups, sound effects, visualization, personas, and voice cloning.

Examples:

Generate a song from a text prompt

client = RunApi::Suno::Client.new(api_key: "sk-your-api-key")
result = client.text_to_music.run(
  prompt: "A chill lo-fi beat with soft vocals",
  model: "suno-v4.5-plus"
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key: nil, **options) ⇒ Client

Returns a new instance of Client.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/runapi/suno/client.rb', line 61

def initialize(api_key: nil, **options)
  super

  @text_to_music = Resources::TextToMusic.new(http)
  @extend_music = Resources::ExtendMusic.new(http)
  @stitch_audio = Resources::StitchAudio.new(http)
  @remaster_audio = Resources::RemasterAudio.new(http)
  @add_samples = Resources::AddSamples.new(http)
  @generate_artwork = Resources::GenerateArtwork.new(http)
  @cover_audio = Resources::CoverAudio.new(http)
  @add_instrumental = Resources::AddInstrumental.new(http)
  @add_vocals = Resources::AddVocals.new(http)
  @separate_audio_stems = Resources::SeparateAudioStems.new(http)
  @generate_midi = Resources::GenerateMidi.new(http)
  @convert_audio = Resources::ConvertAudio.new(http)
  @visualize_music = Resources::VisualizeMusic.new(http)
  @generate_lyrics = Resources::GenerateLyrics.new(http)
  @blend_lyrics = Resources::BlendLyrics.new(http)
  @get_timestamped_lyrics = Resources::GetTimestampedLyrics.new(http)
  @replace_section = Resources::ReplaceSection.new(http)
  @create_mashup = Resources::CreateMashup.new(http)
  @text_to_sound = Resources::TextToSound.new(http)
  @voice_to_validation_phrase = Resources::VoiceToValidationPhrase.new(http)
  @regenerate_validation_phrase = Resources::RegenerateValidationPhrase.new(http)
  @generate_voice = Resources::GenerateVoice.new(http)
  @check_voice = Resources::CheckVoice.new(http)
  @generate_persona = Resources::GeneratePersona.new(http)
  @boost_style = Resources::BoostStyle.new(http)
end

Instance Attribute Details

#add_instrumentalResources::AddInstrumental (readonly)

Returns generates and adds an instrumental backing track to uploaded audio.

Returns:



25
26
27
# File 'lib/runapi/suno/client.rb', line 25

def add_instrumental
  @add_instrumental
end

#add_samplesObject (readonly)

Returns the value of attribute add_samples.



19
20
21
# File 'lib/runapi/suno/client.rb', line 19

def add_samples
  @add_samples
end

#add_vocalsResources::AddVocals (readonly)

Returns generates and adds vocals to an uploaded instrumental track.

Returns:



27
28
29
# File 'lib/runapi/suno/client.rb', line 27

def add_vocals
  @add_vocals
end

#blend_lyricsResources::BlendLyrics (readonly)

Returns blends two caller-authored lyrics texts.

Returns:



39
40
41
# File 'lib/runapi/suno/client.rb', line 39

def blend_lyrics
  @blend_lyrics
end

#boost_styleResources::BoostStyle (readonly)

Returns generates style/genre tags from a text description (synchronous).

Returns:



59
60
61
# File 'lib/runapi/suno/client.rb', line 59

def boost_style
  @boost_style
end

#check_voiceResources::CheckVoice (readonly)

Returns step 4 of voice cloning: checks whether a custom voice is ready (synchronous).

Returns:

  • (Resources::CheckVoice)

    step 4 of voice cloning: checks whether a custom voice is ready (synchronous)



55
56
57
# File 'lib/runapi/suno/client.rb', line 55

def check_voice
  @check_voice
end

#convert_audioResources::ConvertAudio (readonly)

Returns converts a generated track to WAV format.

Returns:



33
34
35
# File 'lib/runapi/suno/client.rb', line 33

def convert_audio
  @convert_audio
end

#cover_audioResources::CoverAudio (readonly)

Returns re-records vocals over an uploaded audio file with a new style or voice.

Returns:



23
24
25
# File 'lib/runapi/suno/client.rb', line 23

def cover_audio
  @cover_audio
end

#create_mashupResources::CreateMashup (readonly)

Returns blends two audio tracks into a single new composition.

Returns:



45
46
47
# File 'lib/runapi/suno/client.rb', line 45

def create_mashup
  @create_mashup
end

#extend_musicResources::ExtendMusic (readonly)

Returns continues an existing track from a specified timestamp.

Returns:



18
19
20
# File 'lib/runapi/suno/client.rb', line 18

def extend_music
  @extend_music
end

#generate_artworkResources::GenerateArtwork (readonly)

Returns creates cover artwork for an existing music task.

Returns:



21
22
23
# File 'lib/runapi/suno/client.rb', line 21

def generate_artwork
  @generate_artwork
end

#generate_lyricsResources::GenerateLyrics (readonly)

Returns produces AI-generated lyrics from a text prompt.

Returns:



37
38
39
# File 'lib/runapi/suno/client.rb', line 37

def generate_lyrics
  @generate_lyrics
end

#generate_midiResources::GenerateMidi (readonly)

Returns extracts per-instrument MIDI note data from a generated track.

Returns:



31
32
33
# File 'lib/runapi/suno/client.rb', line 31

def generate_midi
  @generate_midi
end

#generate_personaResources::GeneratePersona (readonly)

Returns creates a reusable style or voice persona from a track's vocals (synchronous).

Returns:



57
58
59
# File 'lib/runapi/suno/client.rb', line 57

def generate_persona
  @generate_persona
end

#generate_voiceResources::GenerateVoice (readonly)

Returns step 3 of voice cloning: trains a custom voice.

Returns:



53
54
55
# File 'lib/runapi/suno/client.rb', line 53

def generate_voice
  @generate_voice
end

#get_timestamped_lyricsResources::GetTimestampedLyrics (readonly)

Returns retrieves word-level timing alignment for a track (synchronous).

Returns:



41
42
43
# File 'lib/runapi/suno/client.rb', line 41

def get_timestamped_lyrics
  @get_timestamped_lyrics
end

#regenerate_validation_phraseResources::RegenerateValidationPhrase (readonly)

Returns step 2 (optional) of voice cloning: requests a new phrase.

Returns:



51
52
53
# File 'lib/runapi/suno/client.rb', line 51

def regenerate_validation_phrase
  @regenerate_validation_phrase
end

#remaster_audioObject (readonly)

Returns the value of attribute remaster_audio.



19
20
21
# File 'lib/runapi/suno/client.rb', line 19

def remaster_audio
  @remaster_audio
end

#replace_sectionResources::ReplaceSection (readonly)

Returns re-generates a time range within an existing track.

Returns:



43
44
45
# File 'lib/runapi/suno/client.rb', line 43

def replace_section
  @replace_section
end

#separate_audio_stemsResources::SeparateAudioStems (readonly)

Returns splits a track into individual instrument stems.

Returns:



29
30
31
# File 'lib/runapi/suno/client.rb', line 29

def separate_audio_stems
  @separate_audio_stems
end

#stitch_audioObject (readonly)

Returns the value of attribute stitch_audio.



19
20
21
# File 'lib/runapi/suno/client.rb', line 19

def stitch_audio
  @stitch_audio
end

#text_to_musicResources::TextToMusic (readonly)

Returns generates songs from a text prompt with configurable vocal mode, style, and persona.

Returns:

  • (Resources::TextToMusic)

    generates songs from a text prompt with configurable vocal mode, style, and persona



16
17
18
# File 'lib/runapi/suno/client.rb', line 16

def text_to_music
  @text_to_music
end

#text_to_soundResources::TextToSound (readonly)

Returns generates sound effects from a text description.

Returns:



47
48
49
# File 'lib/runapi/suno/client.rb', line 47

def text_to_sound
  @text_to_sound
end

#visualize_musicResources::VisualizeMusic (readonly)

Returns generates a music visualization video from an existing track.

Returns:



35
36
37
# File 'lib/runapi/suno/client.rb', line 35

def visualize_music
  @visualize_music
end

#voice_to_validation_phraseResources::VoiceToValidationPhrase (readonly)

Returns step 1 of voice cloning: extracts a validation phrase.

Returns:



49
50
51
# File 'lib/runapi/suno/client.rb', line 49

def voice_to_validation_phrase
  @voice_to_validation_phrase
end