Saving a .wav file

How to save a tune in scamp in .wav format

1 Like

see: Can we send SCAMP output to a .wav file?

Thanks :slight_smile:

from scamp import *
playback_settings.recording_file_path = “rec.wav”
s = Session()

playback_settings.recording_file_path = “GUITAR_TUNE/rec.wav”

s.tempo = 120

guitar = s.new_part(‘guitar’)

a = b = 1

count = 0

while count!=3:

guitar.play_note(48+a,0.7,0.25)

a,b = b, (a+b)%15

count+=1

This was my code snippet but it is not saving the file.

You have multiple playback_settings.recording_file_path statements. Probably only the first one would work?

Hello Marc,

Hope all is well. On this topic, I would like to record to a wav file without using a sound card and in real time. How would I accomplish that? Also, is mp3 an option? Thanks in advance for your help.

Andrew

I discovered something about fluidsynth! Had no idea you could do this, but if you set the default audio driver to “file”, it creates a file in the same folder as the script called “fluidsynth.wav” and instead of playing back to the speakers, it plays back to that file. E.g.:

from scamp import *
import random

s= Session(default_audio_driver="file")

piano = s.new_part("piano")

for _ in range(50):
    piano.play_note(random.uniform(60, 80), random.uniform(0.5, 0.9), 0.1)

It tends to leave a fair amount of blank audio at the end of the file for some reason, but other than that, I think it does exactly what you want!