import matplotlib pyplot as plt from scipy io wavfile import write provide the file where the output file should be savedoutput_file 'audio_signal_generated wavnowspecify the parameters of your choiceas shownduration in seconds frequency_sampling in hz frequency_tone min_val - np pi max_val np pi in this stepwe can generate the audio signalas shownt np linspace(min_valmax_valduration frequency_samplingaudio_signal np sin( np pi tone_freq tnowsave the audio file in the output filewrite(output_filefrequency_samplingsignal_scaledextract the first values for our graphas shownaudio_signal audio_signal[: time_axis np arange( len(signal) float(sampling_freqnowvisualize the generated audio signal as followsplt plot(time_axissignalcolor='blue'plt xlabel('time in milliseconds'plt ylabel('amplitude'plt title('generated audio signal'plt show(