-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
disable tagger on not main, created first example
- Loading branch information
Showing
3 changed files
with
113 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ name: tagger | |
on: | ||
push: | ||
branches: | ||
- "*" | ||
- "main" | ||
|
||
jobs: | ||
tagger: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"math/rand" | ||
"os" | ||
|
||
"github.com/sopro-dev/sopro-core/audio" | ||
"github.com/sopro-dev/sopro-core/audio/formats/pcm" | ||
"github.com/sopro-dev/sopro-core/audio/formats/ulaw" | ||
) | ||
|
||
func main() { | ||
numSamples := 80000 | ||
numChannels := 2 | ||
samplesPerSecond := 44100 | ||
|
||
inputData := make([]byte, numSamples*numChannels) | ||
for i := 0; i < numSamples; i++ { | ||
// Calculate the current second | ||
currentSecond := i / samplesPerSecond | ||
|
||
// Generate noise for the first second, then silence for the second second | ||
if currentSecond%2 == 0 { | ||
sample := byte(127 * (2.0*rand.Float64() - 1.0)) // Generate random noise | ||
inputData[i*numChannels] = sample | ||
inputData[i*numChannels+1] = sample | ||
} else { | ||
inputData[i*numChannels] = 0 // Silence | ||
inputData[i*numChannels+1] = 0 // Silence | ||
} | ||
} | ||
|
||
audioInfo := audio.AudioInfo{ | ||
SampleRate: 44100, | ||
Channels: numChannels, | ||
BitDepth: 16, | ||
FloatFormat: false, | ||
} | ||
|
||
transcoder := audio.NewTranscoder(&pcm.PCMFormat{}, &ulaw.ULawFormat{}) | ||
outputData := transcoder.Transcode(inputData, audioInfo) | ||
|
||
// Process the output data as needed... | ||
fmt.Println(outputData[:200]) | ||
|
||
// Store the output data to a file... | ||
f, err := os.Create("output.ul") | ||
if err != nil { | ||
panic(err) | ||
} | ||
defer f.Close() | ||
|
||
_, err = f.Write(outputData) | ||
if err != nil { | ||
panic(err) | ||
} | ||
} |