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.



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/runapi/suno/client.rb', line 58

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

  @text_to_music = Resources::TextToMusic.new(http)
  @extend_music = Resources::ExtendMusic.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)
  @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:



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

def add_instrumental
  @add_instrumental
end

#add_vocalsResources::AddVocals (readonly)

Returns generates and adds vocals to an uploaded instrumental track.

Returns:



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

def add_vocals
  @add_vocals
end

#boost_styleResources::BoostStyle (readonly)

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

Returns:



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

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)



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

def check_voice
  @check_voice
end

#convert_audioResources::ConvertAudio (readonly)

Returns converts a generated track to WAV format.

Returns:



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

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:



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

def cover_audio
  @cover_audio
end

#create_mashupResources::CreateMashup (readonly)

Returns blends two audio tracks into a single new composition.

Returns:



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

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:



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

def generate_artwork
  @generate_artwork
end

#generate_lyricsResources::GenerateLyrics (readonly)

Returns produces AI-generated lyrics from a text prompt.

Returns:



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

def generate_lyrics
  @generate_lyrics
end

#generate_midiResources::GenerateMidi (readonly)

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

Returns:



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

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:



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

def generate_persona
  @generate_persona
end

#generate_voiceResources::GenerateVoice (readonly)

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

Returns:



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

def generate_voice
  @generate_voice
end

#get_timestamped_lyricsResources::GetTimestampedLyrics (readonly)

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

Returns:



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

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:



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

def regenerate_validation_phrase
  @regenerate_validation_phrase
end

#replace_sectionResources::ReplaceSection (readonly)

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

Returns:



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

def replace_section
  @replace_section
end

#separate_audio_stemsResources::SeparateAudioStems (readonly)

Returns splits a track into individual instrument stems.

Returns:



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

def separate_audio_stems
  @separate_audio_stems
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:



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

def text_to_sound
  @text_to_sound
end

#visualize_musicResources::VisualizeMusic (readonly)

Returns generates a music visualization video from an existing track.

Returns:



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

def visualize_music
  @visualize_music
end

#voice_to_validation_phraseResources::VoiceToValidationPhrase (readonly)

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

Returns:



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

def voice_to_validation_phrase
  @voice_to_validation_phrase
end