PCM5102 DAC w. Raspberry Pi Zero / 3B+ / 4
StackExchange is ridiculous and won't let me reply to threads without becoming a regular member first.
Resources
These links cover everything you need to know:
export function CalculatePixels( str, el ) { | |
try { | |
const value = parseFloat( str ) | |
const unit = str.replace(value, '').toLowerCase() | |
const { innerWidth, innerHeight } = window | |
const run = { | |
['%']: () => (el.offsetWidth * (value/100)), | |
px: () => value, | |
vw: () => (innerWidth * (value/100)), |
# brew install folderify | |
# brew install imagemagick | |
#!/bin/bash | |
# Using pip install ffmpeg-normalize | |
for f in ${1}*.wav | |
do | |
echo $f | |
ffmpeg-normalize ${f} -of ${1}normalized/ -ext wav | |
done |
StackExchange is ridiculous and won't let me reply to threads without becoming a regular member first.
Resources
These links cover everything you need to know:
Any PCM5102A board connected up to pins:
VIN = 3.3V (NOT 5V)
GND = GND
LCK = GPIO19/35 (PCM FS)
DIN = GPIO21/40 (PCM DOUT)
BCK = GPIO18/12 (PCM CLK)
import { writable, get } from 'svelte/store' | |
const ERROR = 'error' | |
const SUCCESS = 'success' | |
const TRY = 'try' | |
function init() { | |
const { subscribe, set, update, get } = writable({ | |
log: [], |
const timestamp = e => Math.floor(Date.now() / 1000) | |
const date = timestamp => new Date( timestamp * 1000 ) |
const moveInArray = (arr, from, to) => { | |
if (to >= arr.length) { | |
var k = to - arr.length + 1 | |
while (k--) { | |
arr.push(undefined) | |
} | |
} | |
arr.splice(to, 0, arr.splice(from, 1)[0]) | |
return arr | |
} |
export default text => text.toString().toLowerCase() | |
.replaceAll(' ', '-') // Replace spaces with - | |
.replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
.replace(/\-\-+/g, '-') // Replace multiple - with single - |
// request is deprecated and stackoverflow is crusty | |
const download = async (url, dest) => { | |
return await new Promise((resolve, reject)=> { | |
const file = fs.createWriteStream(dest) | |
const request = https.get(url, (res) => { | |
if (res.statusCode !== 200) return resolve( res ) | |
const size = res.headers[ 'content-length' ] | |
let pro = 0 |