asmr-video-generator

A library for programmatically generating ASMR video content using Elixir. This package streamlines the creation of relaxing and engaging visual and auditory experiences.

Installation

Add asmr_video_generator to your list of dependencies in mix.exs: elixir def deps do [

{:asmr_video_generator, "~> 0.1.0"}

] end

After adding the dependency, run: shell mix deps.get

Usage

Here are a few examples demonstrating how to use asmr_video_generator in your Elixir application.

1. Generating a Simple ASMR Video with Default Settings: elixir alias AsmrVideoGenerator, as: AVG

= AVG.generate(duration: 60, output_path: "output.mp4")

IO.puts("ASMR video generated at: #{video_path}")

This example generates a 60-second ASMR video using default settings and saves it to "output.mp4".

2. Customizing Audio and Visual Elements: elixir alias AsmrVideoGenerator, as: AVG

options = %{ duration: 120, output_path: "custom_video.mp4", audio: %{

type: :nature,
subtype: :rainforest

}, visual: %{

type: :abstract,
colors: ["#ADD8E6", "#00008B"]

} }

case AVG.generate(options) do {:ok, video_path} ->

IO.puts("Custom ASMR video generated at: #{video_path}")

->

IO.puts("Error generating video: #{reason}")

end

This example demonstrates how to customize the audio and visual elements of the generated video. It uses pattern matching to handle both success and error scenarios.

3. Creating a Sequence of ASMR Segments: elixir alias AsmrVideoGenerator, as: AVG

segment_1 = %{duration: 30, audio: %{type: :tapping}, visual: %{type: :geometric}} segment_2 = %{duration: 30, audio: %{type: :whispering}, visual: %{type: :particles}}

[segment_1, segment_2] |> Enum.map(&AVG.generate(&1)) |> Enum.each(fn {:ok, video_path} -> IO.puts("Segment generated at: #{video_path}") {:error, reason} -> IO.puts("Error generating segment: #{reason}") end)

This example generates two ASMR video segments and concatenates them. It uses Enum.map and Enum.each for concise and functional processing.

4. Using Pipes for Option Configuration: elixir alias AsmrVideoGenerator, as: AVG

options = %{duration: 45, output_path: "piped_video.mp4"} |> Map.put(:audio, %{type: :brushing}) |> Map.put(:visual, %{type: :gradient, direction: :vertical})

case AVG.generate(options) do {:ok, video_path} ->

IO.puts("Piped ASMR video generated at: #{video_path}")

->

IO.puts("Error generating video: #{reason}")

end

This example uses the pipe operator (|>) to configure the options map in a readable and maintainable way.

5. Handling Complex Error Scenarios: elixir alias AsmrVideoGenerator, as: AVG

try do AVG.generate(duration: 600, output_path: "") # Intentionally invalid output_path rescue e ->

IO.puts("Caught exception: #{e}")

else {:ok, video_path} -> IO.puts("Video generated successfully at: #{video_path}") {:error, reason} -> IO.puts("Error generating video: #{reason}") end

This example uses try/rescue/else to handle potential exceptions and errors during video generation, demonstrating robust error handling.

Features

License

MIT

This package is part of the asmr-video-generator ecosystem. For advanced features and enterprise-grade tools, visit: https://supermaker.ai/video/asmr-video-generator/