Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio resampling. #1294

Merged
merged 1 commit into from
Sep 17, 2023
Merged

Audio resampling. #1294

merged 1 commit into from
Sep 17, 2023

Conversation

shogo4405
Copy link
Owner

@shogo4405 shogo4405 commented Sep 15, 2023

Description & motivation

  • refs Audio enhancements #1276
  • I have added a feature to maintain a constant sampling rate during the broadcast, as a consistent sampling rate and channel configuration are preferable during streaming.

Usage

stream.audioSettings = .init(
  bitRate: 64 * 1000,
  sampleRate: 44100.0,
  channels: 1
) 

/**
A value of 0 corresponds to the same sampling rate and channel count as the input data.
The maximum value is a sampling rate of 48kHz and a channel count of 2 channels.

stream.audioSettings = .init(
  bitRate: 64 * 1000,
  sampleRate: 0,
  channels: 0
) 
*/

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Tests

RTMP Streaming

iOS(iPhone14 Pro max iOS16.6)

  • Built-In Microphone: <AVAudioFormat 0x283935a90: 1 ch, 44100 Hz, Int16> numSamples = 1024
    • sampleRate: 48000Hz
    • sampleRate: 16000Hz
  • Built-In Microphone: <AVAudioFormat 0x283935a90: 2 ch, 44100 Hz, Int16> numSamples = 1024
    • sampleRate: 48000Hz
    • sampleRate: 16000Hz
  • AirPods: <AVAudioFormat 0x2828fc690: 1 ch, 24000 Hz, Int16> numSamples = 1024
    • sampleRate: 48000Hz
    • sampleRate: 16000Hz
  • ReplayKit appAudio: <AVAudioFormat 0x2826edae0: 2 ch, 44100 Hz, Int16, interleaved>
    • sampleRate: 48000Hz
    • sampleRate: 16000Hz
      iPadOS(IPadAit 5h/iOS17.0)
  • ZOOM AMS-44: <AVAudioFormat 0x2826edae0: 4 ch, 44100 Hz, Int16, interleaved>
    • sampleRate: 48000Hz
    • sampleRate: 16000Hz

macOS(MacBook Pro 14inch 2021 Ventura 13.5.2)

  • Built-In Microphone: <AVAudioFormat 0x283935a90: 1 ch, 44100 Hz, Float32> numSamples = 512
    • sampleRate: 48000Hz
    • sampleRate: 16000Hz
  • Loopback audio: AVAudioFormat 0x6000026bd4a0: 6 ch, 48000 Hz, Float32, deinterleaved> numSamples = 512
    • sampleRate: 48000Hz, channel: 0
    • sampleRate: 16000Hz, channel: 1
  • BOMGE BMG22 USB: <AVAudioFormat 0x600002825b80: 2 ch, 192000 Hz, Float32, deinterleaved>
    • sampleRate: 48000Hz, channel: 0

Recording

iOS

  • Built-In Microphone: <AVAudioFormat 0x283935a90: 1 ch, 44100 Hz, Int16> numSamples = 1024

IPadOS

  • ZOOM AMS-44: <AVAudioFormat 0x2826edae0: 4 ch, 44100 Hz, Int16, interleaved>

Screenshots:

@shogo4405 shogo4405 added this to the 1.7.0 milestone Sep 15, 2023
@shogo4405 shogo4405 force-pushed the feature/resampler branch 2 times, most recently from e476a48 to 4b948e7 Compare September 15, 2023 07:06
@shogo4405 shogo4405 force-pushed the feature/resampler branch 13 times, most recently from 7410a22 to 211dd14 Compare September 16, 2023 04:01
@shogo4405 shogo4405 force-pushed the feature/resampler branch 10 times, most recently from bea275d to b8fcb9e Compare September 17, 2023 14:43
@shogo4405 shogo4405 marked this pull request as ready for review September 17, 2023 15:03
@shogo4405 shogo4405 merged commit 3d7b1c3 into main Sep 17, 2023
1 check passed
@shogo4405 shogo4405 deleted the feature/resampler branch September 17, 2023 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant