Are these things possible with JULIA? I think I can use aplayer and arecord through JULIA (I am on Linux), but I was wishing to have all the code contained within JULIA.
Many thanks, I hope you can point me in the right direction.
# sinegen.jl
#=
Just a simple generator of sine waves. It even records stuff!
=#
using WAV
# User defined stuff:
# Define Sample Frequency:
Fs = 96000# Hz
# Define Frequency of Wave:
f = 440 # Hz
# Define Duration:
T = 10 #s
# Define Audio File variables:
nbits = 32
# Format:
fformat = "wav"
# Define Audio Driver and AudioDevice for playback
adriver = "alsa"
adev = "hw:1"
# Execute:
# Time window:
t = (1/Fs) * collect(0:(T*Fs - 1)) #s
# Signal:
y = sin(2π*f*t)
# File Name:
fname = "Sine $f.$fformat"
# Save the sine wave:
wavwrite(y,Fs,nbits,fname)
# Set Driver and device for sox:
ENV["AUDIODRIVER"] = adriver
ENV["AUDIODEV"] = adev
# And now, play it with sox from command line.
# run(`play -b $nbits -r $Fs $fname`)
# To record for a lenght of time T:
# run(`rec -b $nbits -r $Fs Output.wav trim 0 $T `)
# To play and record simultaneously:
run(`play -b $nbits -r $Fs $fname` & `rec -b $nbits -r $Fs Output.wav trim 0 $T `)I am starting looking into your module and... ehm... what is the proper way to install it?
Pkg.build("PortAudio")