From 96734619777da86219e62c452c38fd36bf1a58c3 Mon Sep 17 00:00:00 2001 From: Sarvesh Ahuja <102516359+ahuja-sarvesh@users.noreply.github.com> Date: Tue, 4 Apr 2023 20:07:08 +0530 Subject: [PATCH] Fixed issue in synthesizer music module(chapter 7), float type error fix Updated building the time axis under the synthesizer function by type casting 'duration * sampling_freq' into 'int' --- Module 1/Chapter 7/synthesize_music.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Module 1/Chapter 7/synthesize_music.py b/Module 1/Chapter 7/synthesize_music.py index 8c8fb1c..7e74693 100644 --- a/Module 1/Chapter 7/synthesize_music.py +++ b/Module 1/Chapter 7/synthesize_music.py @@ -6,7 +6,7 @@ # Synthesize tone def synthesizer(freq, duration, amp=1.0, sampling_freq=44100): # Build the time axis - t = np.linspace(0, duration, duration * sampling_freq) + t = np.linspace(0, duration, int(duration * sampling_freq)) # Construct the audio signal audio = amp * np.sin(2 * np.pi * freq * t)