Play audio and restart it onclick

To just restart the song, you’d do: function play() { var audio = document.getElementById(‘audio1′); if (audio.paused) { audio.play(); }else{ audio.currentTime = 0 } } FIDDLE To toggle it, as in the audio stops when clicking again, and when click another time it restarts from the beginning, you’d do something more like : function play() { … Read more

How to convert a .wav file to a spectrogram in python3

Use scipy.signal.spectrogram. import matplotlib.pyplot as plt from scipy import signal from scipy.io import wavfile sample_rate, samples = wavfile.read(‘path-to-mono-audio-file.wav’) frequencies, times, spectrogram = signal.spectrogram(samples, sample_rate) plt.pcolormesh(times, frequencies, spectrogram) plt.imshow(spectrogram) plt.ylabel(‘Frequency [Hz]’) plt.xlabel(‘Time [sec]’) plt.show() Be sure that your wav file is mono (single channel) and not stereo (dual channel) before trying to do this. I highly … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)