Skip to content

Segmentation fault in shiny.py (line 510 #76

@ccsumvid

Description

@ccsumvid

I am running python 3.12 on Mac OS X Sonoma 14.3.
see the file for full lldb output.
segmentationfault.txt

First note is playing and then I am getting multiple lines displaying the following line and segmentation fault.
(<frame at 0x107b1e2a0, file '/Users/cc/raga/.venv/lib/python3.12/site-packages/simpleaudio/shiny.py', line 51, code is_playing>, 'call', None) {}

this is my code.

`
def play_note_with_portamento(self, start_freq, end_freq, duration, portamento=.2):
t = np.linspace(0, duration, int(DEFAULT_SAMPLE_RATE * duration), False)
num_points = len(t)
portamento_points = int(num_points * portamento)
steady_points = num_points - portamento_points

    freq = np.concatenate([
        np.linspace(start_freq, end_freq, portamento_points),
        np.linspace(end_freq, end_freq, steady_points)
    ])
    
    audio = np.sin(2 * np.pi * freq * t)
    
    # Apply envelope and effects
    envelope = np.linspace(0, 1, len(audio))
    envelope = np.minimum(envelope, np.flip(envelope))
    audio *= envelope
    
    max_amplitude = np.max(np.abs(audio))
    target_amplitude = 0.8
    if max_amplitude > 0:
        audio = audio * (target_amplitude / max_amplitude)
    
    audio = (audio * 32767).astype(np.int16)
    play_obj = sa.play_buffer(audio, CHANNELS, BYTES_PER_SAMPLE, DEFAULT_SAMPLE_RATE)
    play_obj.wait_done()

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions