freq = 4 lines = 200 max = 30
period = freq * Math.PI unit = period / lines
for ( let i = 0; i < period; i += unit ) {
let ii = ( Math.sin( i ) + 1 ) * max
if ( ii < 1 ) ii = 1
let s = ''
for ( let j = 0; j < ii; j ++ ) {
s += '█'
}
console.log( s )
}
// paste the above code in your browser's dev console and press ENTER // play around with the values of freq, lines, and max to achieve diferent results